package com.shop.admin.job;


import com.shop.admin.service.pink.StorePinkService;
import com.shop.admin.service.pink.StoreSnapPinkService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class StorePinkJob {

    @Autowired
    private StorePinkService storePinkService;
    @Autowired
    private StoreSnapPinkService storeSnapPinkService;


    //100元区拼团
    @Async("storePinkScheduler")
    @Scheduled(cron = "0 */3 * * * ?")
    //@Scheduled(cron = "0/30 * * * * ?")
    public void storePink(){
        log.info("--- 拼团任务开始 ---");
        storePinkService.exeStorePink();
        log.info("--- 拼团任务结束 ---");
    }


    //200元区抢购
    @Async("storePinkScheduler")
    @Scheduled(cron = "0 */1 * * * ?")
    public void storeSnapPink(){
        log.info("--- 抢购拼团任务开始 ---");
        storeSnapPinkService.exeStorePink();
        log.info("--- 抢购拼团任务结束 ---");
    }

}
